# -*- coding:utf-8 -*-
'''
设置功能使用的视图
'''
from django.shortcuts import render
from django.contrib.auth.decorators import login_required

from .forms import OrgUnitForm, SysParamForm, DptMtForm
from .models import DptMt


@login_required()
def base_setting(request):
    '''
    系统参数设置
    '''
    return render(request, "style/setting/base_setting.html")


@login_required()
def unit_setting(request):
    """
    单位信息设置
    """
    if request.method == 'POST':
        pass
    else:
        form = OrgUnitForm()
    return render(request, 'style/setting/unit_setting.html', {'form': form})


@login_required()
def dptmt_setting(request):
    """
    部门设置
    :param request:
    :return:
    """
    if request.method == 'POST':
        pass
    else:
        form = DptMtForm()
        get_data = DptMt.objects.all()
        print(get_data[0].__dict__)
        return render(request, 'style/setting/dpt_setting.html', {'form': form})


